package com.lg.mengbase.testBottonTab;

import android.support.v4.app.Fragment;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import com.lg.baselibrary.activity.BaseBottomViewPagerTabActivity;
import com.lg.baselibrary.widget.TabItemView;
import com.lg.mengbase.R;
import com.lg.mengbase.TestKeyboardListenerAty;
import com.lg.mengbase.testBottonTab.fragment.TabFragment1;
import com.lg.mengbase.testBottonTab.fragment.TabFragment2;
import com.lg.mengbase.testBottonTab.fragment.TabFragment3;
import com.lg.mengbase.testBottonTab.fragment.TabFragment4;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by LiGang on 2017/5/29.
 * Tabs+ViewPager+Fragment(CenterView)
 */

public class TestBottomTabViewPagerActivity2 extends BaseBottomViewPagerTabActivity{
    @Override
    protected List<TabItemView> getTabViews() {
        List<TabItemView> tabItemViews = new ArrayList<>();
        tabItemViews.add(new TabItemView(this,"首页",R.color.bottom_tab_text_def,
                R.color.bottom_tab_text_selected,R.mipmap.bottom_feed_normal,R.mipmap.bottom_feed_press));
        tabItemViews.add(new TabItemView(this,"热榜",R.color.bottom_tab_text_def,
                R.color.bottom_tab_text_selected,R.mipmap.bottom_hotrank_normal,R.mipmap.bottom_hotrank_press));
        tabItemViews.add(new TabItemView(this,"发现",R.color.bottom_tab_text_def,
                R.color.bottom_tab_text_selected,R.mipmap.bottom_discovery_normal,R.mipmap.bottom_discovery_press));
        tabItemViews.add(new TabItemView(this,"我",R.color.bottom_tab_text_def,
                R.color.bottom_tab_text_selected,R.mipmap.bottom_my_normal,R.mipmap.bottom_my_press));
        return tabItemViews;
    }

    @Override
    protected List<Fragment> getFragments() {
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(new TabFragment1());
        fragments.add(new TabFragment2());
        fragments.add(new TabFragment3());
        fragments.add(new TabFragment4());
        return fragments;
    }

    private Animation centerAnimation;
    @Override
    protected void setCenterView() {
        super.setCenterView();
        centerAnimation = AnimationUtils.loadAnimation(this,R.anim.anim_bottom_centerview_press);
        centerAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                startActivity(TestKeyboardListenerAty.class);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        setCenterView(R.layout.v_bottom_tab_centerview, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.startAnimation(centerAnimation);
            }
        });
    }

    @Override
    protected void initData() {
        showTipCount(3,5);
    }

}
